package com.jxdinfo.hussar.cloud.module.example.dljc.basketpoint.controller;

import com.jxdinfo.hussar.cloud.module.example.dljc.basketpoint.model.BasketPoint;
import com.jxdinfo.hussar.cloud.module.example.dljc.basketpoint.service.BasketPointService;
import com.jxdinfo.hussar.cloud.module.example.dljc.basketpoint.vo.BasketImgPointVO;
import com.jxdinfo.hussar.cloud.module.example.dljc.basketpoint.vo.BasketPointPageVO;
import com.jxdinfo.hussar.cloud.module.example.dljc.basketpoint.vo.BasketPointSearchVO;
import com.jxdinfo.hussar.cloud.module.example.dljc.basketpoint.vo.BasketPointVO;
import com.jxdinfo.hussar.cloud.module.example.tjjc.towercrane.vo.DeviceInfoVO;
import com.jxdinfo.hussar.platform.core.base.apiresult.ApiResponse;
import com.jxdinfo.hussar.support.audit.core.annotations.AuditLog;
import com.jxdinfo.hussar.support.audit.core.enums.AuditEventGrade;
import com.jxdinfo.hussar.support.audit.core.enums.AuditEventType;
import com.jxdinfo.hussar.support.mp.base.controller.HussarBaseController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 吊篮监测点控制器
 */
@RestController(value = "dljc.basketpoint.BasketPointController")
@AuditLog(moduleName = "吊篮监测点")
@RequestMapping(value = "/dljc/basketPoint")
public class BasketPointController extends HussarBaseController<BasketPoint, BasketPointService> {

    private static final Logger logger = LoggerFactory.getLogger(BasketPointController.class);

    @Autowired
    private BasketPointService basketPointService;

    /**
     * 分页查询吊篮
     *
     * @param basketPointSearchVO
     * @return 查询结果
     */
    @AuditLog(moduleName = "吊篮监测点", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.INSERT)
    @PostMapping("findByPage")
    public ApiResponse<BasketPointPageVO> findByPage(@RequestBody BasketPointSearchVO basketPointSearchVO) {
        //todo 没有获取项目编号工具类

        return basketPointService.findByPage(basketPointSearchVO);
    }

    /**
     * 条件查询
     *
     * @param basketPointSearchVO
     * @return 查询结果
     */
    @AuditLog(moduleName = "吊篮监测点", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.INSERT)
    @PostMapping("findByList")
    public ApiResponse<List<BasketPointVO>> findByList(@RequestBody BasketPointSearchVO basketPointSearchVO) {
        //todo 没有获取项目编号工具类

        return basketPointService.findByList(basketPointSearchVO);
    }

    /**
     * 根据id查询吊篮
     *
     * @param id
     * @return 查询结果
     */
    @AuditLog(moduleName = "吊篮监测点", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.INSERT)
    @PostMapping("findOne")
    public ApiResponse<BasketPointVO> findOne(@RequestParam String id) {
        //todo 没有获取项目编号工具类
        String tyProjectCode = "";

        return basketPointService.findOne(id);
    }

    /**
     * 根据设备类型获取吊篮监测设备列表
     * @param basketPointSearchVO 入参
     * @return 查询结果
     */
    @AuditLog(moduleName = "吊篮监测点", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.QUERY)
    @PostMapping(path = "findDeviceByProductType")
    public ApiResponse<List<DeviceInfoVO>> findDeviceByProductType(@RequestBody BasketPointSearchVO basketPointSearchVO){
        //todo 没有获取项目编号工具类

        return basketPointService.findDeviceByProductType(basketPointSearchVO);
    }

    /**
     * 吊篮图片检测点条件查询
     *
     * @param basketPointSearchVO
     * @return 查询结果
     */
    @AuditLog(moduleName = "吊篮监测点", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.INSERT)
    @PostMapping("findByImgPonitList")
    public ApiResponse<BasketImgPointVO> findByImgPonitList(@RequestBody BasketPointSearchVO basketPointSearchVO) {
        //todo 没有获取项目编号工具类

        return basketPointService.findByImgPonitList(basketPointSearchVO);
    }

    /**
     * 吊篮检测点数量查询
     *
     * @param basketPointSearchVO
     * @return 查询结果
     */
    @AuditLog(moduleName = "吊篮监测点", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.INSERT)
    @PostMapping("findPointCount")
    public ApiResponse<List<Map<String,Object>>> findPointCount(@RequestBody BasketPointSearchVO basketPointSearchVO) {
        //todo 没有获取项目编号工具类

        return basketPointService.findPointCount(basketPointSearchVO);
    }

    /**
     * 吊篮检测点新增
     *
     * @param basketPointSearchVO
     * @return 查询结果
     */
    @AuditLog(moduleName = "吊篮监测点", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.INSERT)
    @PostMapping("add")
    public ApiResponse<String> add(@RequestBody BasketPointSearchVO basketPointSearchVO) {
        //todo 没有获取项目编号工具类

        return basketPointService.add(basketPointSearchVO);
    }

    /**
     * 吊篮检测点修改
     *
     * @param basketPointSearchVO
     * @return 查询结果
     */
    @AuditLog(moduleName = "吊篮监测点", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.INSERT)
    @PostMapping("update")
    public ApiResponse<String> update(@RequestBody BasketPointSearchVO basketPointSearchVO) {
        //todo 没有获取项目编号工具类

        return basketPointService.updateBasketPoint(basketPointSearchVO);
    }

    /**
     * 修改通知
     *
     * @param basketPointSearchVO
     * @return 查询结果
     */
    @AuditLog(moduleName = "吊篮监测点", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.INSERT)
    @PostMapping("updateNotice")
    public ApiResponse<String> updateNotice(@RequestBody BasketPointSearchVO basketPointSearchVO) {
        //todo 没有获取项目编号工具类

        return basketPointService.updateNotice(basketPointSearchVO);
    }

    /**
     * 根据id删除吊篮
     *
     * @param basketPointSearchVO
     * @return 查询结果
     */
    @AuditLog(moduleName = "吊篮监测点", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.INSERT)
    @PostMapping("deleteById")
    public ApiResponse<String> deleteById(@RequestBody BasketPointSearchVO basketPointSearchVO) {
        //todo 没有获取项目编号工具类

        return basketPointService.deleteById(basketPointSearchVO);
    }
}
